# Maintainer: Venji10 <bennisteinir@gmail.com>

# Reference: <https://postmarketos.org/vendorkernel>
# Kernel config based on: arch/arm64/configs/beryllium_defconfig

pkgname=linux-xiaomi-beryllium
pkgver=4.9.182
pkgrel=1
pkgdesc="Xiaomi Poco F1 kernel fork"
arch="aarch64"
_carch="arm64"
_flavor="xiaomi-beryllium"
url="https://kernel.org"
license="GPL-2.0-only"
options="!strip !check !tracedeps pmb:cross-native"
makedepends="perl sed installkernel bash gmp-dev bc linux-headers elfutils-dev devicepkg-dev"


# Source
_repository="android_kernel_xiaomi_sdm845"
_commit="0c1feb8b3a7cc62aed52346331f64190e644cca9"
_config="config-$_flavor.$arch"
source="
	$pkgname-$_commit.tar.gz::https://github.com/LineageOS/$_repository/archive/$_commit.tar.gz
	$_config
	linux4.2-gcc10-extern_YYLOC_global_declaration.patch
"
builddir="$srcdir/$_repository-$_commit"
_outdir="out"

prepare() {
	default_prepare
	. downstreamkernel_prepare
}

build() {
	unset LDFLAGS
	make ARCH="$_carch" CC="${CC:-gcc}" \
		KBUILD_BUILD_VERSION="$((pkgrel + 1 ))-postmarketOS" \
		O="$_outdir"
}

package() {
	downstreamkernel_package "$builddir" "$pkgdir" "$_carch" "$_flavor" "$_outdir"
}

sha512sums="60f63841673f31e1faf9f26113e93ca5ccf83925618bc35d1f6e11744f2f0f295bf32cfb6f9ece1d104868ed12af5ac76dea2ee39b4fb26b0569c8779ce0d74d  linux-xiaomi-beryllium-0c1feb8b3a7cc62aed52346331f64190e644cca9.tar.gz
7b65640db5d7af99188ef9cda90198a322f9c02a83a9ec0c3d85994e6adb97d2226e0d5a9afc194cce38b9552047c2e7724c2acd07c5ce172998b94a59d4e59e  config-xiaomi-beryllium.aarch64
eaf2e61fcb508cdd239b8fed209d2a09ecac77287f6b46d003918fdf1c6fa2ee63f7390f3ff7c49029b8ed6cbcdd81c7e9a4b1ece9f5060b6fc84e322bd47f41  linux4.2-gcc10-extern_YYLOC_global_declaration.patch"
